package dp.gupiao;
//121. 买卖股票的最佳时机
public class Num121_maxProfi {
    public int maxProfit(int[] prices) {
        int low = Integer.MAX_VALUE;
        int res = 0;
        for (int i = 0; i < prices.length; i++) {
            low = Math.min(low , prices[i]);
            res = Math.max(res , prices[i] - low);
        }
        return res;

    }
}
